package org.finesys.common.websocket.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Data
@ConfigurationProperties(prefix = WebSocketProperties.PREFIX)
public class WebSocketProperties {
    public static final String PREFIX = "websocket";
    /**
     * 启用webSocket
     */
    private boolean enabled = false;
    /**
     * webSocket端点
     */
    private String endpoint = "/ws";
    /**
     * webSocket端口
     */
    private String port = "8080";
    /**
     * webSocket前缀
     */
    private List<String> applicationDestinationPrefixes = new ArrayList<>(Arrays.asList("/app"));
    /**
     * 用户推送前缀
     */
    private String userDestinationPrefix = "/user";
    /**
     * broker
     */
    private List<String> brokerPaths = new ArrayList<>(Arrays.asList("/topic", "/user"));
    /**
     * 心跳时间
     */
    private long heartBeatIn = 30000L;
    /**
     * 心跳时间
     */
    private long heartBeatOut = 30000L;
    /**
     * 线程池配置
     */
    @NestedConfigurationProperty
    private WebSocketTaskProperties task;
}


